﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.RepositoryFramework;

namespace Ue.Qcdz.Domain.TheResource
{
    public class ResourceService
    {
        private static IResourceRepository _repository;
        static ResourceService()
        {
            ResourceService._repository = RepositoryFactory.GetRepository<IResourceRepository, Resource>();
        }
        public static Resource GetResource(object resourceKey)
        {
            return ResourceService._repository.FindBy(resourceKey);
        }
        public static IList<Resource> GetResource()
        {
            return ResourceService._repository.FindAll();
        }
        public static IDataResult<Resource> GetResource(IDataQuery dataQuery)
        {
            return ResourceService._repository.FindBy(dataQuery);
        }
        public static void AddResource(Resource resource)
        {
            ResourceService._repository.Add(resource);
        }
        public static void UpdateResource(Resource resource)
        {
            ResourceService._repository[resource.Key] = resource;
        }
    }
}
